<template>
  <div class="order_list" v-loading.fullscreen.lock="fullscreenLoading" element-loading-text="加载中...">
    <div class="common_form_search">
      <el-form ref="searchForm" :inline="true" :model="searchForm">
        <el-form-item label="订单号">
          <el-input v-model="searchForm.orderNo" style="width: 220px" placeholder="请输入订单号" clearable
            @keyup.enter.native="search" />
        </el-form-item>
        <el-form-item label="ID">
          <el-input v-model="searchForm.orderID" placeholder="请输入ID" clearable @keyup.enter.native="search" />
        </el-form-item>
        <el-form-item label="商品名称">
          <el-input v-model="searchForm.goodsName" placeholder="请输入商品名称" clearable />
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchForm.receivingName" placeholder="请输入用户名" clearable />
        </el-form-item>
        <el-form-item label="是否缴押金">
          <el-select v-model="searchForm.is_ready_check" placeholder="请选择是否缴押金" clearable>
            <el-option v-for="item in authList" :key="item.id" :label="item.label" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="手机号">
          <el-input v-model="searchForm.receivingMobile" placeholder="请输入手机号" clearable @keyup.enter.native="search" />
        </el-form-item>
        <el-form-item label="状态">
          <el-select v-model="searchForm.orderStatus" placeholder="全部" clearable>
            <el-option v-for="item in selectList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="创建时间">
          <my-date-picker ref="myDatePicker" />
        </el-form-item>
        <el-form-item label="供应商">
          <el-input v-model="searchForm.shopName" placeholder="请输入供应商" clearable />
        </el-form-item>
        <el-form-item label="地址">
          <el-input v-model="searchForm.address" placeholder="请输入地址" clearable />
        </el-form-item>
        <el-form-item label="线上/线下">
          <el-select v-model="searchForm.orderFrom" placeholder="全部" clearable>
            <el-option v-for="item in onlineList" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" @click="search()">查询</el-button>
          <el-button size="small" @click="reset()">重置</el-button>
          <el-button v-if="$hasMethod('#export')" size="small" type="warning" @click="exportFile()">导出</el-button>
          <!-- <el-button v-if="$hasMethod('#export')" size="small" type="warning" @click="exportFile2()">导出2</el-button> -->
        </el-form-item>
      </el-form>
    </div>
    <el-divider />
    <div class="child_page">
      <el-tabs v-model="activeName" class="flex-1 nav_tabs" @tab-click="handleClick">
        <el-tab-pane v-for="item in tabList" :key="item.id" :label="`${item.name}(${item.count})`" :name="item.id" />
      </el-tabs>
      <div class="list_wrap" v-loading="listLoading">
        <div class="flex list_header">
          <p style="width: 27%; padding-left: 20px">商品信息</p>
          <p class="text-center" style="width: 3%">数量</p>
          <p class="text-center" style="width: 10%">租金</p>
          <p class="text-center" style="width: 9%">租期</p>
          <p class="text-center" style="width: 10%">押金</p>
          <p class="text-center" style="width: 15%">实付金额</p>
          <p class="text-center" style="width: 8%">是否买断</p>
          <p class="text-center" style="width: 7%">下期付款金额</p>
          <p style="width: 15%; padding-left: 20px">收货人信息</p>
        </div>
        <div v-for="(item, itemIndex) in tableData" :key="item.id" class="list_item">
          <div class="flex justify-between align-center item_header">
            <!-- item.statusName  -->
            <el-tag :type="getOrderStatusType(item.status)">{{
              item.status == 3 ? (item.is_ready_check == 1 ? '审核中' : item.is_ready_check == 2 ? '预审通过' :
                item.is_ready_check == 3 ? '匹配商家' : '待审核') : item.statusName
            }}</el-tag>
            <div class="flex-1 flex align-center">
              <p>ID：{{ item.id }}</p>
              <p>商品ID：{{ item.goods_id }}</p>
              <p>创建时间：{{ item.create_time }}</p>
              <p>订单号：{{ item.trade_no }}</p>
              <p>供应商：{{ item.shopname }}
                <el-button v-if="item.status == 3 || item.status == 2 && $hasMethod('#checkPass')" size="mini"
                  class="border-btn" style="padding: 0 5px;" @click="editorder(item, 4)">更改</el-button>
                <el-button v-if="item.status == 3 || item.status == 2 && $hasMethod('#checkPass')" class="border-btn"
                  style="margin-left: 5px;padding: 0 5px;" @click="editorder(item, 6)">推送</el-button>
                <el-button v-if="item.status == 3 || item.status == 2 && $hasMethod('#checkPass')" size="mini"
                  class="border-btn" style="padding: 0 5px;" @click="editorder(item, 1)">分配</el-button>
              </p>
              <p>门店：{{ item.s_name ? item.s_name : '无' }}
                <el-button v-if="item.status == 3 || item.status == 2 && $hasMethod('#checkPass')" size="mini"
                  class="border-btn" style="padding: 0 5px;" @click="editorder(item, 7)">更改</el-button>
              </p>
              <p>
                快递信息：
                <span class="blue-font pointer" @click="checkLogistics(item)">
                  {{ item.logistic.delivery_type == 2 ? "上门自取" : item.logistic.delivery_type == 3 ? "上门安装" :
                    item.logistic.logistics_no ? `${item.logistic.logistics_no}(${item.logistic.logistics_name})` : "无"
                  }}
                </span>
              </p>
            </div>
            <p>
              <!-- <el-button type="primary" size="mini">订单设置</el-button> -->
            </p>
          </div>
          <div class="flex justify-between align-center item_header">
            <div class="flex-1 flex align-center" style="margin-left:-10px">
              <p>定位地址：{{ item.location == "" ? "暂无地址信息" : item.location }}
              </p>
              <p>下单设备型号：{{ item.device == "" ? "暂无设备信息" : item.device }}</p>
              <p>支付宝/微信来源：{{ item.scene == "" ? "暂无来源信息" : item.scene }}</p>
              <p>公证状态：{{ item.notar_list ? (item.notar_list.notar_status ? item.notar_list.notar_status : '暂无公证信息') :
                "暂无公证信息"
                }}</p>
              <p>外部订单状态：{{ item.shop_from ? item.shop_from : '暂无外部订单状态' }}</p>
              <p>订单来源：
                {{ item.source }}<span v-if="item.sale_user_id">-{{ item.sale_user_id }}</span>
                <!-- <span v-if="item.is_alipay_order==2">{{ item.source }}<span v-if="item.sale_user_id">-{{ item.sale_user_id }}</span></span>
                <span v-else style="font-size: 12px;color: #2993ff;">租物频紧急联系人道商品</span> -->
              </p>
            </div>
          </div>
          <div class="flex item_row">
            <div class="flex" style="width: 27%">
              <div>
                <el-image style="width:100px;height: 100px;position:relative;top:20px;"
                  :src="item.imgurl ? $globalObj.imgBaseUrl + item.imgurl : ''">
                  <div slot="error" class="image-slot">
                    <i class="el-icon-picture-outline" />
                  </div>
                </el-image>
                <div style="position:relative;top:-110px;font-size: 12px;color: red;height: 28px;">
                  <span v-show="item.activity_title ? true : false" style="font-size:15px;font-weight: 500">活动:</span>
                  {{ item.activity_title }}<br>
                  <span v-show="item.activity_type ? true : false" style="font-size: 12px;color: red;">租物频道商品</span>
                </div>
                <div style="position:relative;top:-10px;">
                  <el-tooltip class="item" effect="dark" content="联通5G活动" placement="top-start">
                    <img v-if="(item.is_unicom_choose == 1)" src="../../assets/images/unicom.png" style="width: 15px;"
                      alt="联通5G活动" />
                  </el-tooltip>
                  <el-tooltip class="item" effect="dark" content="已购买碎屏险" placement="top-start">
                    <img v-if="(item.is_insurance_choose != 7)" src="../../assets/images/insurance.png"
                      style="width: 15px;" alt="购买碎屏险" />
                  </el-tooltip>
                </div>
              </div>
              <div class="flex-1" style="padding-left: 10px;">
                <el-tooltip class="item" effect="dark" placement="top-start" :content="item.goods_title">
                  <p class="text-ellipsis title blue-font"
                    style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 400px;">
                    <span>({{ item.new_grade_title }})</span>{{ item.goods_title }}
                  </p>
                </el-tooltip>
                <el-tooltip class="item" effect="dark" placement="top-start" :content="item.setmeal_title">
                  <p class="meal" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 300px;">
                    套餐方式：{{ item.setmeal_title }}

                  </p>
                </el-tooltip>
                <p class="meal">租赁方式：{{ item.pact_type }}
                </p>
                <p class="device"> 设备编号：{{ item.device_number }}
                  <el-button v-if="$hasMethod('#editDevice')" size="mini" class="border-btn" style="margin-left: 5px"
                    @click="editDevice(item)">更改</el-button>
                </p>
                <div class="device" style="display: flex;">
                  <div>商品套餐：</div>
                  <div>
                    <el-button size="mini" class="border-btn" style="margin-left: 5px;margin-top:5px"
                      @click="editMeal(item.id, item.goods_id)" type="warning">修改套餐</el-button>
                    <el-button size="mini" class="border-btn" style="margin-left: 5px;margin-top:5px"
                      @click="openEditMeal(item.id, item.goods_title, item.setmeal_title, itemIndex)"
                      type="warning">修改商品信息</el-button>
                    <br>
                    <span style="font-size:15px;color: #fff;">
                      <el-tag :type="item.is_supervise == 2 ? '' : 'warning'"
                        :style="item.is_supervise == 2 ? 'color: #2993ff;margin-right:10px;margin-left:10px' : 'color: #e6a23c;margin-right:10px;margin-left:10px'">{{
                          item.is_supervise == 1 ? '非监管' : '监管' }}</el-tag>
                      <el-tag :type="item.is_latest_performance_time == 2 ? '' : 'warning'"
                        :style="item.is_latest_performance_time == 2 ? 'color: #2993ff;' : 'color: #e6a23c;'">{{
                          item.is_latest_performance_time == 1 ? '有履约' : '无履约' }}</el-tag>
                    </span>
                  </div>
                </div>
              </div>
            </div>
            <div class="flex flex-center color-666 font-16" style="width: 3%">
              x{{ item.amount }}
            </div>
            <div class="flex flex-column flex-center" style="width: 10%">
              <p class="red-font">
                ￥{{ item.rent_total }}(共{{ item.month_total }}期)
              </p>
              <!-- <p class="color-666">￥{{(item.rent_total/item.month_total).toFixed(2)}}({{item.month_total}}期)</p> -->
              <p style="margin-top: 10px">
                <el-button v-if="$hasMethod('#checkLease')" size="mini" class="border-btn"
                  @click="viewLease(item)">查看租期</el-button>
              </p>
              <p style="margin-top: 10px">
                <el-button v-if="item.status == 3 && $hasMethod('#checkPass')" size="mini" class="border-btn"
                  style="padding: 0 5px;" @click="editorder(item, 2)">修改租期租金</el-button>
              </p>
            </div>
            <div style="width: 9%" class="color-666 font-12  flex-center">
              <div>{{ item.begin_time }}至{{ item.end_time }}(共{{ item.month_total }}期)</div>
              <div style="margin-top: 10px">
                <!-- <el-button v-if="item.status == 3 && $hasMethod('#checkPass')" size="mini" class="border-btn" style="padding: 0 5px;" @click="editorder(item, 2)">更改租期</el-button> -->
              </div>
            </div>

            <div style="width: 10%" class="flex flex-column flex-center">
              <p v-if="item.rights_auth_no" class="red-font">
                ￥{{ item.foregift_pay ? item.foregift_pay : item.foregift }}
              </p>
              <p v-if="item.foregift_deduct > 0" class="color-999 font-12" style="text-decoration: line-through">
                ￥{{ item.foregift_pay ? item.part_foregift : item.all_foregift }}
              </p>
              <p v-if="item.status == 2 && item.is_amount_apply == 1" style="margin-top: 10px">
                <el-button size="mini" class="border-btn" @click="editorder(item, 5)">更改押金</el-button>
              </p>
              <p class="color-999 font-12">
              <div class="color-999 font-12">
                {{ item.foregift_deduct == 0 ? "押金冻结" : item.foregift_pay > 0 ? "部分免押" : "押金全免" }}
              </div>
              <div class="color-999 font-12" style="text-align: center;">
                押金充值：{{ item.orderRechargeDeposit.amount || '0.00' }}
                <template v-if="JSON.stringify(item.orderRechargeDeposit) !== '[]'">
                  &nbsp;元&nbsp;({{ item.orderRechargeDeposit.status == '1' ? '未充值' :
                    item.orderRechargeDeposit.status == '2' ? '充值成功' : '已退款' }})
                </template>
                <template v-else>元&nbsp;(未充值)
                </template>
                <el-button
                  v-if="$hasMethod('#setMoney') && (JSON.stringify(item.orderRechargeDeposit) == '[]' || item.orderRechargeDeposit.status == '1')"
                  size="mini" class="border-btn" @click="setMoney(item.id)">设置充值押金</el-button>
                <el-button
                  v-if="$hasMethod('#quitMoney') && (JSON.stringify(item.orderRechargeDeposit) !== '[]' && item.orderRechargeDeposit.status == '2')"
                  size="mini" class="border-btn" @click="quitMoney(item.id)">退充值押金</el-button>
              </div>

              </p>
              <!-- <p class="color-999 font-12">
                {{ item.foregift_deduct == 0 ? "押金冻结" : item.foregift_pay > 0 ? "部分免押" : "押金全免" }}
              </p> -->

            </div>
            <div style="width: 15%" class="flex flex-column flex-center">
              <p class="red-font">￥{{ item.lease.paid_rent }}</p>
              <p class="color-999 font-12">
                {{ item.pay_type == 1 ? "智能合同代扣" :
                  item.pay_type == 2 ? "支付宝预授权（" + (item.rights_auth_no != 0 ? "已授权代扣" : "未授权代扣") + "）" :
                    item.pay_type == 7 ? "银行卡代扣" :
                      "花呗" }}
              </p>
              <p style="margin-top: 5px">
                <el-button size="mini" type="success" class="long-text-btn"
                  @click="checkPaidBill(item.id, item.lease.paid_rent)">已付：￥{{ item.lease.paid_rent }}/￥{{
                    item.rent_total
                  }}</el-button>
              </p>
              <p style="margin-top: 5px">
                <el-button size="mini" type="warning">已结租金￥{{ item.lease.settle_amount }}</el-button>
              </p>
            </div>
            <div style="width: 8%" class="flex flex-center flex-column font-12 color-666">
              <p v-if="item.is_buy_out == 1" class="text-center">
                买断金: ￥{{ item.setmeal_price }}
              </p>
            </div>
            <div style="width: 7%" class="flex flex-column flex-center">
              <template v-if="JSON.stringify(item.lease.next) !== '[]'">
                <p class="font-12 color-666">￥{{ item.lease.next.amount }}</p>
                <p class="font-12 color-666">{{ item.lease.next.date }}</p>
              </template>
            </div>
            <div style="width: 15%">
              <p class="flex align-center justify-between font-12 color-666">
                <span>{{ item.realname }}</span>
                <span>{{ encryptPhoneNumber(item.address_mobile) }}</span>
              </p>
              <p class="font-12 color-666" style="word-break: break-all">
                {{ item.prov + item.city + item.area + item.address }}
              </p>
              <p style="margin-top: 10px">
                <el-button v-if="$hasMethod('#editAddress')" size="mini" class="border-btn"
                  @click="editAddress(item)">修改地址</el-button>
              </p>
            </div>
          </div>
          <div class="flex item_row">
            <div style="width: 57%" class="detail">
              <p class="color-666">
                认证资料：{{ item.authentic.cert_name }}（{{ item.authentic.cert_no }}）手机号：{{ item.mobile
                }}，人脸识别{{ item.authentic.status == 1 ? "通过" : "不通过" }}
                性别：{{ item.authentic.sex }} 年龄：{{ item.authentic.age }}
                <el-button
                  v-if="item.authentic.idcard_back && item.authentic.idcard_front && $hasMethod('#checkAuthInfo')"
                  size="mini" class="border-btn" @click="checkAuthInfo(item)">认证资料</el-button>
              </p>
              <p class="color-666" style="padding: 5px 0px;">
                风控建议：
                <template v-if="JSON.stringify(item.orderRemark1) !== '[]'">
                  {{ item.orderRemark1.remark }}
                  <span v-if="$hasMethod('#checkRemark')" class="blue-font pointer" style="margin-right: 10px"
                    @click="viewRemark(item.id, 1)">查看建议记录</span>
                </template>
                <el-button v-if="$hasMethod('#addRemark')" size="mini" type="warning" plain
                  @click="addRemark(item.id, '1')">添加风控建议</el-button>
                <el-button v-if="item.status == 3" size="mini" class="border-btn" plain
                  @click="handleSelect(item.id)">查询风控建议</el-button>
                <el-button v-if="item.status == 3" size="mini" @click="handleFraud(item.id)"
                  class="border-btn">查询反欺诈</el-button>
              </p>
              <p class="color-666 flex" style="flex-wrap:wrap" :class="{ 'red-font': item.is_skip == 1 }">
                风控信息：{{ item.is_skip == 1 ? "【未风控】商家跳过风控" : item.risk }}
                <el-button v-if="item.is_skip == 0 && $hasMethod('#riskControl')" size="mini" class="border-btn"
                  @click="openTip(item)">蚁盾风控</el-button>
                <el-button size="mini" class="border-btn" style="padding: 0 1px;" @click="antsDialog(item)"> 蚂蚁风控
                </el-button>
                <!-- <el-button size="mini" class="border-btn" style="padding: 0 1px;"
                  @click="handleOrderData(item)">查看大数据</el-button> -->
                <el-button size="mini" class="border-btn" style="padding: 0 1px;"
                  @click="publicDialog(item)">查看雷达风控数据</el-button>
                <el-button size="mini" class="border-btn" style="padding: 0 1px;"
                  @click="getBigData(item)">查看大数据</el-button>
                <!-- <el-button size="mini" class="border-btn" style="padding: 0 1px;"
                  @click="handleApply(item)">租赁申请</el-button> -->
                <!-- <el-button size="mini" class="border-btn" style="padding: 0 1px;" @click="billAbDialog(item)">查看钞能力风控数据</el-button> -->
                <!-- <el-button size="mini" class="border-btn" style="padding: 0 1px;"
                  @click="selectCredit(item)">{{ isSuccess == 1 ? '已查询征信风控报告' : isSuccess == 2 ? '该用户征信查询失败' : isSuccess == 3 ? '查询征信申请中' : '查看征信风控报告' }}</el-button> -->
                <credit-btn ref="creditBtn" @handleClick="selectCredit" :item-list="item"
                  :status-name="item?.is_success"></credit-btn>
                <el-button @click="handleEdu(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">查看学历</el-button>
                <el-button @click="handleSesame(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">芝麻风控</el-button>
                <!-- <el-button @click="handleProbe(item)" size="mini" class="border-btn" style="padding: 0 5px;">查看探针</el-button> -->
                <el-button @click="handleEconomy(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">经济能力</el-button>
                <el-button @click="handleRisk(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">风险前筛</el-button>
                <el-button @click="handleAntCredit(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">信贷洞察</el-button>
                <el-button @click="handleAntFraud(item)" size="mini" class="border-btn"
                  style="padding: 0 5px;">反欺诈价值</el-button>
                <el-button @click="handleThree(item, 1)" size="mini" class="border-btn"
                  style="padding: 0 5px;">三网查询</el-button>
                <el-button @click="handleThree(item, 2)" size="mini" class="border-btn"
                  style="padding: 0 5px;">运营商信息</el-button>
              </p>
              <p class="color-666 red-font" style="padding: 5px 0px;">
                紧急联系人：{{ item.emergency_contact }}
                <el-button size="mini" class="border-btn" style="padding: 0 5px;"
                  @click="handleMobile(item)">手机二要素</el-button>
              </p>
              <!-- <p class="color-666 red-font">
                用户邮箱：{{ item.emergency_contact }}
                <el-button size="mini" class="border-btn" style="padding: 0 5px;" @click="handleEmail(item)">添加邮箱</el-button>
              </p> -->
              <p class="color-666 font-12">用户备注：{{ item.remark }}</p>
              <p class="color-666 font-12">
                客服备注：
                <template v-if="JSON.stringify(item.orderRemark) !== '[]'">
                  {{ item.orderRemark.create_time }}，{{ item.orderRemark.username }}添加备注：{{ item.orderRemark.remark }}
                  <span v-if="$hasMethod('#checkRemark')" class="blue-font pointer" style="margin-right: 10px"
                    @click="viewRemark(item.id, 9)">查看备注记录</span>
                </template>
                <el-button v-if="$hasMethod('#addRemark')" size="mini" class="border-btn"
                  @click="addRemark(item.id, '2')">添加备注</el-button>
              </p>
              <p class="color-666" style="margin-top: 5px">
                <template v-if="JSON.stringify(item.leaseFlow) !== '[]'">
                  第{{ item.leaseFlow.which_period }}期通过支付宝
                  {{ item.leaseFlow.pay_type == 1 ? "智能合同代扣" : item.leaseFlow.pay_type == 2 ? "芝麻信用" :
                    item.leaseFlow.pay_type == 3 ? "花呗" : "主动支付" }}
                  {{ item.leaseFlow.status == 1 ? "支付" + item.leaseFlow.rent + "元" : item.leaseFlow.status == 2 ? "退款" +
                    item.leaseFlow.rent + "元" : item.leaseFlow.status == 3 ? "买断" : "未支付" }}
                </template>
                <el-button v-if="$hasMethod('#checkFlow')" size="mini" class="border-btn"
                  @click="viewFlow(item.trade_no)">流水记录</el-button>
              </p>

            </div>
            <div style="width: 43%" class="flex flex-column justify-center">
              <p v-if="item.orderRefundReason" style="padding: 0 10px">
                退款原因：{{ item.orderRefundReason }}
              </p>
              <p v-if="item.is_renewal == 1" style="margin-left: 10px">
                原订单号：<span class="blue-font">{{ item.parent_order_no }}</span>
              </p>
              <p v-if="item.is_abnormal == 1 && [41, 42, 43, 44, 45, 49, 60, 65].indexOf(item.status) > -1"
                class="red-font" style="margin-left: 10px"> 该订单提前归还</p>
              <p v-if="item.check_refuse_reason && item.status == 43" class="red-font" style="margin-left: 10px">
                审核拒绝原因：{{ item.check_refuse_reason }}
              </p>
              <!-- <p style="" class="btns flex align-center every flex-wrap">
        <el-row :gutter="20">
          <el-col :span="8">
          <el-button v-if="item.is_set==1 && item.result1 && item.result2" size="mini" type="success">已上征信</el-button>
          <el-button v-else  @click="setCreditData(item.id)" size="mini" type="primary">上征信</el-button>
        </el-col>
        </el-row>
        </p> -->
              <p style="" class="btns flex align-center every flex-wrap tip_img">
                <el-tooltip class="item" effect="dark" content="用户授权协议已签署" placement="top-start">
                  <img v-if="item.flow_id_2" src="../../assets/images/db-signed.png" alt="用户授权协议已签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="用户授权协议未签署" placement="top-start">
                  <img v-if="!item.flow_id_2" src="../../assets/images/db-unsign.png" alt="用户授权协议未签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="个人征信授权书已签署" placement="top-start">
                  <img v-if="item.flow_id_3" src="../../assets/images/db-signed.png" alt="个人征信授权书已签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="个人征信授权书未签署" placement="top-start">
                  <img v-if="!item.flow_id_3" src="../../assets/images/db-unsign.png" alt="个人征信授权书未签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="融资租赁委托担保合同已签署" placement="top-start">
                  <img v-if="item.flow_id_4" src="../../assets/images/dan_yes.png" alt="融资租赁委托担保合同已签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="融资租赁委托担保合同未签署" placement="top-start">
                  <img v-if="!item.flow_id_4" src="../../assets/images/dan_no.png" alt="融资租赁委托担保合同未签署">
                </el-tooltip>
                <el-tooltip class="item zheng" effect="dark" content="已上征信" placement="top-start">
                  <img v-if="item.is_credit == 1" src="../../assets/images/zheng_yes.png" alt="已上征信">
                </el-tooltip>
                <el-tooltip class="item zheng" effect="dark" content="未上征信" placement="top-start">
                  <img v-if="item.is_credit == 2" src="../../assets/images/zheng_no.png" alt="未上征信">
                </el-tooltip>
                <!-- <el-tooltip class="item zheng" effect="dark" content="已上征信" placement="top-start">
                  <img v-if="item.result2_time" src="../../assets/images/zheng_yes.png" alt="已上征信">
                </el-tooltip>
                <el-tooltip class="item zheng" effect="dark" content="未上征信" placement="top-start">
                  <img v-if="!item.result2_time" src="../../assets/images/zheng_no.png" alt="未上征信">
                </el-tooltip> -->
                <el-tooltip class="item" effect="dark" content="租赁合同未签署" placement="top-start">
                  <img v-if="item.sign_status != 1 && item.sign_status != 2" src="../../assets/images/unsign.png"
                    alt="合同未签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="租赁合同签署中" placement="top-start">
                  <img v-if="item.sign_status == 1" src="../../assets/images/signing.png" alt="合同签署中">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="租赁合同已签署" placement="top-start">
                  <img v-if="item.sign_status == 2" src="../../assets/images/signed.png" alt="合同已签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证合同未签署" placement="top-start">
                  <img v-if="item.is_lease == 1" src="../../assets/images/unnotarization.png" style="" alt="公证未签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证合同签署中" placement="top-start">
                  <img v-if="item.is_lease == 3" src="../../assets/images/notarization.png" style="" alt="公证未签署">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证合同已签署" placement="top-start">
                  <img v-if="item.is_lease == 2" src="../../assets/images/notarizationed.png" alt="合同已签署"
                    @click="textContact(item.notar_list.contact_text)">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证申请表" placement="top-start">
                  <img v-if="!item.notar_list.apply_text" src="../../assets/images/unapply.png" style="" alt="公证申请表">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证申请表已签署" placement="top-start">
                  <img v-if="item.notar_list.apply_text" src="../../assets/images/applyed.png" alt="公证申请表已签署"
                    @click="textApply(item.notar_list.apply_text)">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证告知书" placement="top-start">
                  <img v-if="!item.notar_list.tell_text" src="../../assets/images/tell.png" style="" alt="公证告知书">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="公证告知书已签署" placement="top-start">
                  <img v-if="item.notar_list.tell_text" src="../../assets/images/telled.png" alt="公证告知书已签署"
                    @click="textTell(item.notar_list.tell_text)">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="谈话记录书" placement="top-start">
                  <img v-if="!item.notar_list.talk_text" src="../../assets/images/talk.png" style="" alt="谈话记录书">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="谈话记录书已签署" placement="top-start">
                  <img v-if="item.notar_list.talk_text" src="../../assets/images/talked.png" alt="谈话记录书已签署"
                    @click="textTalk(item.notar_list.talk_text)">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="银行卡未绑定" placement="top-start">
                  <img v-if="item.card_list == ''" src="../../assets/images/unbrank.png" alt="银行卡未绑定">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="银行卡已绑定" placement="top-start">
                  <img v-if="item.card_list != ''" src="../../assets/images/brank.png" alt="银行卡已绑定"
                    @click="handleBrank(item.card_list)">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="未确认收货签收凭证" placement="top-start">
                  <img v-if="!item.flow_id_9" src="../../assets/images/wsh.png" alt="未确认收货签收凭证">
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="已确认收货签收凭证" placement="top-start">
                  <img v-if="item.flow_id_9" src="../../assets/images/ysh.png" alt="已确认收货签收凭证">
                </el-tooltip>
              </p>
              <p style="" class="btns flex align-center flex-wrap">
                <el-button v-if="item.status == 10 && $hasMethod('#delivery')" size="mini" type="warning"
                  @click="openDelivery(item.id)">订单发货</el-button>
                <el-button v-if="item.status == 10 && $hasMethod('#refuseorder')" size="mini" type="danger"
                  @click="refuseorder(item.id)">拒绝订单</el-button>
                <el-button v-if="item.status == 3 && $hasMethod('#checkPass')" size="mini" type="success"
                  @click="checkPass(item.id)">审核通过</el-button>
                <el-button v-if="item.status == 20 && $hasMethod('#receipt')" size="mini" type="warning"
                  @click="confirmReceipt(item.id)">确认收货</el-button>
                <el-button v-if="item.status == 44 && $hasMethod('#confirmR')" size="mini" type="warning"
                  @click="confirmReturn(item.id)">确认归还</el-button>
                <el-button v-if="item.status > 10 && $hasMethod('#deductD')" size="mini" type="primary"
                  @click="deductDeposit(item.id)">扣除押金</el-button>
                <!-- <el-button v-if="item.status == 30 && item.is_pay == 1" size="mini" type="danger" @click="cancelWithholding(item.id)">取消代扣</el-button> -->
                <!-- <el-button
                  v-if="item.status == 45"
                  size="mini"
                  type="warning"
                  @click="finishReturn(item.id)"
                  >归还完成</el-button> -->
                <el-button
                  v-if="[20, 30, 31, 32, 33, 34, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 52, 56, 57, 58].indexOf(item.status) > -1 && $hasMethod('#checkLogistics')"
                  size="mini" type="primary" @click="checkLogistics(item)">查看物流</el-button>
                <el-button
                  v-if="[3, 9, 10, 11, 12, 13, 14, 15, 16, 20, 30, 31, 32, 33, 34, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 52, 56, 57, 58, 60, 61, 62, 63, 64, 65].indexOf(item.status) > -1 && item.pact_url != 0 && item.sign_status == 2"
                  size="mini" type="primary"
                  @click="checkPact(item, $globalObj.imgBaseUrl + item.pact_url)">查看合同</el-button>
                <el-button v-if="[11, 12, 13, 14].indexOf(item.status) > -1" size="mini" type="warning"
                  @click="handleRefundOrder(item.trade_no)">去处理</el-button>
                <el-button
                  v-if="[9, 10, 11, 12, 13, 14, 20, 30, 31, 32, 33, 34, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 52, 56, 57, 58,].indexOf(item.status) > -1 && $hasMethod('#finish')"
                  size="mini" type="success" @click="finishOrder(item.id)">交易完成</el-button>
                <el-button v-if="item.status == 41" size="mini" type="warning"
                  @click="agreeReturn(item.id)">同意归还</el-button>
                <el-button v-if="item.status == 41" size="mini" type="danger"
                  @click="refuseReturn(item.id)">拒绝归还</el-button>
                <el-button v-if="[2, 3, 4].indexOf(item.status) > -1 && $hasMethod('#close')" size="mini" type="danger"
                  @click="closeOrder(item.id)">关闭订单</el-button>
                <el-button v-if="[3].indexOf(item.status) > -1 && $hasMethod('#close')" size="mini" type="danger"
                  @click="refuseOrder2(item.id)">审核拒绝</el-button>
                <el-button v-if="[3, 9, 10, 20, 30].indexOf(item.status) > -1 && item.result1 && item.result2"
                  size="mini" type="success">已上征信</el-button>
                <el-button v-if="[3].indexOf(item.status) > -1 && !item.pact_url_4" size="mini" type="primary"
                  @click="createCreditCompany(item.id)">上征信</el-button>
                <el-button v-if="[3].indexOf(item.status) > -1 && item.is_lease == 1" size="mini" type="primary"
                  @click="notarization(item.id)">上公证</el-button>
                <el-button v-if="[2].indexOf(item.status) > -1 && $hasMethod('#close')" size="mini" type="warning"
                  @click="closeRefuse(item.id)">拒绝订单</el-button>
                <el-button v-if="[4].indexOf(item.status) > -1 && item.is_lease != 1" size="mini" type="warning"
                  @click="passApproval(item.id)">审批通过</el-button>
                <el-button v-if="[4].indexOf(item.status) > -1 && item.is_lease != 1" size="mini" type="warning"
                  @click="rejectApprovalClick(item.id)">审批驳回</el-button>
                <el-button v-if="[4].indexOf(item.status) > -1 && item.is_lease != 1" size="mini" type="warning"
                  @click="cancelApproval(item.id)">取消公证</el-button>
                <!-- <el-button size="mini" type="warning" @click="tempClick(item.id)">账单信息</el-button> -->
                <!-- 支撑样式的隐藏按钮 -->
                <el-button type="primary" style="visibility:hidden" />
              </p>
            </div>
          </div>
        </div>
      </div>
      <custom-page ref="customPage" :total="total" @getList="getList" />
    </div>
    <check-lease ref="checkLease" :order-id="selectedId" />
    <set-address ref="setAddress" :edit-item="editItem" @getList="getList" />
    <edit-order ref="editOrder" :edit-item="editItem" @getList="getList" />
    <select-risk ref="selectRisk" :edit-item="editItem" @getList="getList" />
    <public-dialog ref="publicDialog" v-bind="editItem" />
    <!-- <public-dialog ref="publicDialog" :edit-item="editItem" @getList="getList" @resp-code="respCode" /> -->
    <select-credit ref="selectCredit" :edit-item="editItem" @getList="getList" />
    <set-device ref="setDevice" :edit-item="editItem" @getList="getList" />
    <set-remark ref="setRemark" :order-id="selectedId" :dialog-title="titleDialog" @getList="getList" />
    <set-money ref="setMoney" :order-id="selectedId" @getList="getList" />
    <deduct-dialog ref="deductDialog" :order-id="selectedId" />
    <check-remark ref="checkRemark" :order-id="selectedId" :remark-type="remarkType" @getList="getList" />
    <check-flow ref="checkFlow" :order-no="selectedId" />
    <delivery ref="delivery" :order-id="selectedId" @getList="getList" />
    <receipt ref="receipt" :order-id="selectedId" @getList="getList" />
    <auth-info ref="authInfo" :edit-item="editItem" />
    <check-bill ref="checkBill" :order-id="selectedId" />
    <check-logistics ref="checkLogistics" :edit-item="editItem" />
    <edu-details ref="eduDetails" :edit-item="editItem" />
    <bill-ab-dialog ref="billAbDialog" :edit-item="editItem" @getList="getList"></bill-ab-dialog>
    <new-select-risk ref="newSelectRisk" :order-id="newOrderId" @setIsSuccess="setIsSuccess"></new-select-risk>
    <temp-dialog ref="tempDialog" :order-id="selectedId"></temp-dialog>
    <notarization ref="notarization" :order-id="selectedId"></notarization>
    <reject-approval ref="rejectApproval" :order-id="selectedId" @getList="getList"></reject-approval>
    <set-meal ref="setMeal" :order-id="selectedId" :goods-id="goodsId" @getList="getList"></set-meal>
    <mobile-dialog ref="mobileDialog" :order-id="selectedId" @getList="getList"></mobile-dialog>
    <email-dialog ref="emailDialog" :order-id="selectedId" @getList="getList"></email-dialog>
    <brank-dialog ref="brankDialog" :edit-item="editItem" @getList="getList"></brank-dialog>
    <apply-dialog ref="applyDialog" :edit-item="editItem" @getList="getList"></apply-dialog>
    <fraud-dialog ref="fraudDialog" :order-id="selectedId" @getList="getList"></fraud-dialog>
    <edu-dialog ref="eduDialog" :edit-item="editItem" @getList="getList"></edu-dialog>
    <probe-dialog ref="probeDialog" :edit-item="editItem" @getList="getList"></probe-dialog>
    <ant-economy-dialog ref="antEconomyDialog" :edit-item="editItem" @getList="getList" />
    <ant-limit-dialog ref="antLimitDialog" :edit-item="editItem" @getList="getList" />
    <ant-fraud-dialog ref="antFraudDialog" :edit-item="editItem" @getList="getList" />
    <ant-credit-dialog ref="antCreditDialog" :edit-item="editItem" @getList="getList" />
    <ant-risk-dialog ref="antRiskDialog" :edit-item="editItem" @getList="getList" />
    <three-dialog ref="threeDialog" :edit-item="editItem" @getList="getList" :type="threeType"></three-dialog>
    <brank-details ref="brankDetails"></brank-details>
    <ant-shield ref="antShield" :edit-item="editItem" @getList="getList"></ant-shield>
    <sesame-dialog ref="sesameDialog" :edit-item="editItem" @getList="getList"></sesame-dialog>
    <bigData ref="bigData" :edit-item="editItem"></bigData>
    <!-- 拒绝归还 -->
    <el-dialog title="拒绝归还" :visible.sync="returnVisible" width="500px">
      <el-form :model="returnForm">
        <el-form-item label="拒绝原因" label-width="120px">
          <el-input v-model="returnForm.checkRefuseReason" autocomplete="off" placeholder="请输入拒绝原因" type="text"
            maxlength="50" show-word-limit />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeReturn">取 消</el-button>
        <el-button type="primary" @click="confirmReturnVisible">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog width="500px" title="提示" :visible.sync="orderDialogVisible">
      <el-form ref="ruleFormOrder" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="">
          <!-- <p>首次查看大数据会使风控余量减1次，后续不扣余量并且可"在营销->布尔数据"内查看，是否确认查看大数据?</p> -->
        </el-form-item>
        <el-form-item label="请选择分类" prop="goods_type">
          <el-select v-model="form.goodsType" placeholder="全部" clearable @change="handleChange">
            <el-option v-for="item in goodsType" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="orderDialogVisible = false">取 消</el-button>
        <el-button size="small" type="primary" @click="handleSubmit">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog width="520px" title="提示" :visible.sync="antsDialogVisible">
      <el-form ref="eduForm" :model="eduForm" :rules="rules" label-width="100px">
        <el-form-item label="证书编号" prop="certificateNo">
          <el-tooltip class="item" effect="dark" :content="content" placement="bottom">
            <el-input v-model="eduForm.certificateNo" placeholder="请输入证书编号" type="text" show-word-limit clearable />
          </el-tooltip>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeReturnEdu">取 消</el-button>
        <el-button size="small" type="primary" @click="handleSubmitEdu">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog width="720px" title="修改商品信息" :visible.sync="editMealInfoVisiable" :close-on-click-modal="false"
      :close-on-press-escape="false">
      <el-form ref="eduForm" :model="editMealInfoData" label-width="100px">
        <el-form-item label="商品名称" prop="goods_title">
          <el-input v-model="editMealInfoData.goods_title" type="text" />
        </el-form-item>
        <el-form-item label="套餐方式" prop="setmeal_title">
          <el-input v-model="editMealInfoData.setmeal_title" type="text" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="editMealInfoVisiable = false">取 消</el-button>
        <el-button size="small" type="primary" @click="editMealInfo">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import globalData from '../../utils/global'
import customPage from '@/components/customPage'
import creditBtn from '@/components/creditBtn'
import myDatePicker from '@/components/myDatePicker'
import { orderRechargeRefund, createCreditCompany, getBehaviorData } from '@/api/order'
import {
  orderList,
  orderList2,
  getOrderStatus,
  isOrderRemark,
  orderListExport,
  orderFinish,
  orderReturnAgree,
  orderReturnRefuse,
  orderComfirmReturn,
  orderClose,
  orderRisk,
  orderRefuse,
  setCreditData,
  OrderDetailExport,
  getFirstCreditNewData,
  setOrderLease,
  passOrderApproval,
  rejectOrderApproval,
  cancelOrderApproval,
  reGetRisk
} from '@/api/order'
import { rejectRefund, orderCheckPass } from '../../api/orderRefund'
import checkLease from './dialogs/checklease'
import setAddress from './dialogs/setAddress'
import setDevice from './dialogs/setDevice'
import setRemark from './dialogs/setRemark'
import setMoney from './dialogs/setMoney'
import checkRemark from './dialogs/checkRemark'
import checkFlow from './dialogs/checkFlow'
import delivery from './dialogs/delivery'
import receipt from './dialogs/receipt'
import authInfo from './dialogs/authInfo'
import checkBill from './dialogs/checkBill'
import deductDialog from './dialogs/deductDialog.vue'
import checkLogistics from './dialogs/checkLogistics'
import editOrder from './dialogs/editOrder'
import selectRisk from './dialogs/selectRisk'
import selectCredit from './dialogs/selectCredit'
import publicDialog from './dialogs/publicDialog'
import eduDetails from './dialogs/eduDetails'
import billAbDialog from './dialogs/billAbDialog'
import newSelectRisk from './dialogs/newSelectRisk'
import tempDialog from './dialogs/tempDialog'
import notarization from './dialogs/notarization'
import rejectApproval from './dialogs/rejectApproval'
import setMeal from './dialogs/setMeal'
import mobileDialog from './dialogs/mobileDialog'
import emailDialog from './dialogs/emailDialog'
import brankDialog from './dialogs/brankDialog'
import applyDialog from './dialogs/applyDialog'
import fraudDialog from './dialogs/fraudDialog'
import brankDetails from './dialogs/brankDetails'
import eduDialog from './dialogs/eduDialog'
import probeDialog from './dialogs/probeDialog'
import antEconomyDialog from './dialogs/antEconomyDialog'
import antLimitDialog from './dialogs/antLimitDialog'
import antFraudDialog from './dialogs/antFraudDialog'
import antCreditDialog from './dialogs/antCreditDialog'
import antRiskDialog from './dialogs/antRiskDialog'
import threeDialog from './dialogs/threeDialog'
import antShield from './dialogs/antShield'
import sesameDialog from './dialogs/sesameDialog'
import bigData from './dialogs/bigData.vue'
import { editOrderGoodsData } from '../../api/order'

export default {
  components: {
    myDatePicker,
    customPage,
    checkLease,
    setAddress,
    setDevice,
    setRemark,
    setMoney,
    checkRemark,
    checkFlow,
    delivery,
    receipt,
    authInfo,
    checkBill,
    checkLogistics,
    deductDialog,
    editOrder,
    selectRisk,
    selectCredit,
    publicDialog,
    eduDetails,
    billAbDialog,
    newSelectRisk,
    tempDialog,
    notarization,
    rejectApproval,
    setMeal,
    mobileDialog,
    emailDialog,
    brankDialog,
    applyDialog,
    fraudDialog,
    brankDetails,
    eduDialog,
    probeDialog,
    antEconomyDialog,
    antLimitDialog,
    antFraudDialog,
    antCreditDialog,
    antRiskDialog,
    threeDialog,
    creditBtn,
    antShield,
    sesameDialog,
    bigData
  },
  data() {
    return {
      threeType: 1,
      searchForm: {
        orderID: '',
        orderNo: '',
        goodsName: '',
        receivingName: '',
        receivingMobile: '',
        orderStatus: '',
        orderCreateTime: '',
        shopName: '',
        address: '',
        eduId: '',
        orderFrom: ''
      },
      goodsId: '',
      form: {
        goodsType: ''
      },
      eduForm: {
        order_id: '',
        certificateNo: ''
      },
      goodsType: [
        {
          label: '其他',
          value: 0
        },
        {
          label: '游戏电玩',
          value: 1
        },
        {
          label: '娱乐影音',
          value: 2
        },
        {
          label: '电脑平板',
          value: 3
        },
        {
          label: '手机优选',
          value: 4
        }
      ],
      statusList: globalData.orderStatus,
      total: 0,
      tableData: [],
      activeName: 'all',
      authList: [{
        id: 1,
        label: '是'
      },
      {
        id: 2,
        label: '否'
      }
      ],
      tabList: [
        {
          id: 'all',
          name: '全部订单',
          count: 0
        },
        {
          id: 'notCheck',
          name: '待审核',
          count: 0
        },
        {
          id: 'apply',
          name: '申请中',
          count: 0
        },
        {
          id: 'notPay',
          name: '待付款订单',
          count: 0
        },
        // {
        //   id: 'notRisk',
        //   name: '待风控订单',
        //   count: 0,
        // },
        {
          id: 'deliveredNot',
          name: '待发货订单',
          count: 0
        },
        {
          id: 'deliveredIs',
          name: '已发货订单',
          count: 0
        },
        {
          id: 'orderIng',
          name: '租用中订单',
          count: 0
        },
        {
          id: 'orderCompleted',
          name: '交易完成订单',
          count: 0
        },
        {
          id: 'refuse',
          name: '审核拒绝',
          count: 0
        },
        {
          id: 'orderCancel',
          name: '取消订单',
          count: 0
        },
        {
          id: 'orderReturn',
          name: '归还订单',
          count: 0
        },
        {
          id: 'orderBuyout',
          name: '买断订单',
          count: 0
        },
        {
          id: 'orderRenewal',
          name: '续租订单',
          count: 0
        },
        {
          id: 'orderRefund',
          name: '退款订单',
          count: 0
        }
      ],
      selectedId: '',
      editItem: {},
      selectList: [],
      remarkList: [],
      returnVisible: false,
      antsDialogVisible: false,
      orderDialogVisible: false,
      typeId: '',
      refuseId: '',
      returnForm: {
        checkRefuseReason: ''
      },
      content: '如果没有输入证书编号，则只能查询简要信息如：(姓名、证件号码、学历层次)',
      newOrderId: '',
      isSuccess: '',
      titleDialog: '',
      remarkType: '',
      onlineList: [
        {
          label: '线上',
          value: 0
        },
        {
          label: '线下',
          value: 1
        }
      ],
      fullscreenLoading: false,
      listLoading: false,
      editMealInfoVisiable: false,
      editMealInfoData: {
        orderId: '',
        goods_title: '',
        setmeal_title: '',
        itemdIndex: ''
      }
    }
  },
  created() {
    console.log(this.goodsType[4]?.label);
  },
  mounted() {
    this.form.goodsType = this.goodsType[4].label
    this.typeId = this.goodsType[4].value
    if (this.$route.params.orderId) {
      this.searchForm.orderNo = this.$route.params.orderId
    }
    this.getSelect()
    this.getRemark()
    this.getList()
  },
  methods: {
    // 租赁申请
    handleApply(item) {
      this.editItem = item
      this.$refs.applyDialog.dialogVisible = true
    },
    // 手机号加密
    encryptPhoneNumber(phone) {
      const reg = /(\d{3})\d{4}(\d{4})/
      return String(phone).replace(reg, "$1****$2")
    },
    // 反欺诈查询结果
    handleFraud(id) {
      this.selectedId = id
      this.$refs.fraudDialog.dialogVisible = true
    },
    // 再次查询风控建议
    handleSelect(id) {
      reGetRisk(id).then(res => {
        console.log(res);
        this.getList()
      })
    },
    // 添加邮箱
    handleEmail(item) {
      this.selectedId = item.id
      this.$refs.emailDialog.dialogVisible = true
    },
    // 筛查二要素
    handleMobile(item) {
      this.selectedId = item.id
      this.$refs.mobileDialog.dialogVisible = true
    },
    // 修改套餐
    editMeal(orderId, goodsId) {
      this.goodsId = goodsId
      this.selectedId = orderId
      this.$refs.setMeal.dialogVisible = true
    },
    // 修改商品信息
    openEditMeal(orderId, goodsTitle, setmealTitle, itemdIndex) {
      this.editMealInfoData.orderId = orderId
      this.editMealInfoData.goods_title = goodsTitle
      this.editMealInfoData.setmeal_title = setmealTitle
      this.editMealInfoData.itemdIndex = itemdIndex
      this.editMealInfoVisiable = true
    },
    // 修改商品信息
    editMealInfo() {
      let { orderId, goods_title, setmeal_title, itemdIndex } = this.editMealInfoData
      if (!goods_title || !setmeal_title) {
        return this.$message.info('请填写完整需要修改的商品信息！')
      }
      editOrderGoodsData({ orderId, goods_title, setmeal_title }).then(res => {
        this.$message.success('修改成功！')
        if (this.tableData[itemdIndex] && this.tableData[itemdIndex].id === Number(orderId)) {
          this.tableData[itemdIndex].goods_title = goods_title
          this.tableData[itemdIndex].setmeal_title = setmeal_title
        } else {
          this.getList()
        }
        this.editMealInfoVisiable = false
      }).catch(e => {
        this.$message.error('修改失败！')
      })
    },
    textContact(url) {
      window.open(url)
    },
    textApply(url) {
      window.open(url)
    },
    textTell(url) {
      window.open(url)
    },
    textTalk(url) {
      window.open(url)
    },
    // 查看银行卡信息
    handleBrank(item) {
      this.editItem = item
      this.$refs.brankDialog.dialogVisible = true
    },
    handlePush() {

    },
    setIsSuccess(setIsSuccess) {
      this.isSuccess = setIsSuccess
    },
    openTip(item) {
      // Ant shield
      this.editItem = item
      this.$refs.antShield.dialogVisible = true
      // this.$confirm('是否确认手动风控?', '提示', {
      //   confirmButtonText: '确定',
      //   cancelButtonText: '取消'
      // })
      //   .then(() => {
      //     orderRisk({ orderId: item.id }).then((res) => { })
      //     this.getList()
      //   })
      //   .catch(() => { })
    },
    handleRefundOrder(tradeNo) {
      this.$router.push({ name: 'refundList', params: { tradeNo } })
    },
    // 公证通过
    passApproval(id) {

      this.$confirm(
        '是否确定该用户公证通过',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }
      )
        .then(() => {
          passOrderApproval(id).then(res => {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 审批驳回
    rejectApprovalClick(id) {
      this.selectedId = id
      this.$confirm(
        '是否确定该用户审批驳回',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }
      )
        .then(() => {
          console.log(id);
          this.selectedId = id
          this.$refs.rejectApproval.dialogVisible = true
          this.$refs.rejectApproval.title = '驳回理由'
        })
        .catch(() => { })
    },
    // 取消公证
    cancelApproval(id) {
      this.$confirm(
        '是否确定该用户取消公证',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }
      )
        .then(() => {
          this.selectedId = id
          this.$refs.rejectApproval.dialogVisible = true
          this.$refs.rejectApproval.title = '取消公证'
        })
        .catch(() => { })
    },
    // 上公证信息
    notarization(id) {
      this.$confirm(
        '是否给该用户上协议公证',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }
      )
        .then(() => {
          setOrderLease({ orderId: id }).then(res => {
            this.$message({
              message: '申请成功',
              type: 'success'
            })
            this.getList()
          })
        })
        .catch(() => { })
      // this.selectedId=id
      // this.$refs.notarization.dialogVisible=true
    },
    // 查看合同
    checkPact(item, url) {
      if (item.notar_list.notar_status == "公证已通过") {
        window.open(item.notar_list.notar_url)
      } else {

        window.open(url)
      }
    },
    // 订单完结
    finishOrder(id) {
      this.$confirm(
        '交易完成后进行解约现有款项不退款，并解约代扣无法发起未代扣的期数！selectedId',
        '请确认是否交易完成？',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }
      )
        .then(() => {
          orderFinish(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 同意归还
    agreeReturn(id) {
      this.$confirm('确定要同意归还吗？', '同意归还', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderReturnAgree(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 拒绝归还
    refuseReturn(id) {
      this.refuseId = id
      this.returnVisible = true
    },
    // 订单关闭
    closeOrder(id) {
      this.$confirm('确定要关闭订单吗？', '关闭', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderClose(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 拒绝订单并拉入黑名单
    closeRefuse(id) {
      this.$confirm('确定要拒绝订单吗？', '拒绝', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderRefuse(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 审核拒绝
    refuseOrder2(id) {
      this.$confirm('确定要拒绝订单吗？', '拒绝', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderRefuse(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    closeReturn() {
      this.returnVisible = false
      this.returnForm.checkRefuseReason = ''
    },
    // 蚂蚁风控
    antsDialog(item) {
      this.$confirm('是否确认查看蚂蚁风控?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          this.editItem = item
          this.$refs.eduDetails.dialogVisible = true
        })
        .catch(() => { })
    },
    closeReturnEdu() {
      this.antsDialog = false
      this.eduForm.certificateNo = ''
    },
    handleSubmitEdu() {
      this.$refs['eduForm'].validate((valid) => {
        console.log(this.eduForm);
        if (valid) {
          this.eduId = this.eduForm.certificateNo
          this.antsDialog = false
          this.$refs.eduDetails.dialogVisible = true
          console.log(this.eduForm);
          // this.getList()
          this.eduForm = {}
        } else {
          this.$message({
            message: '请选择类型',
            type: 'error'
          })
          return false
        }
      })
    },
    // 查看钞能力风控数据
    billAbDialog(item) {
      console.log(item);
      this.$confirm('是否确认查看钞能力大数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          this.editItem = {
            orderId: item.id,
            cert_name: item.cert_name,
            cert_no: item.cert_no,
            mobile: item.mobile
          }
          this.$refs.billAbDialog.dialogVisible = true
          // this.getList()
          // this.respCode()
        })
        .catch(() => { })
    },
    confirmReturnVisible() {
      if (!this.returnForm.checkRefuseReason) {
        this.$message.warning('拒绝原因不能为空')
        return false
      }
      orderReturnRefuse({
        orderId: this.refuseId,
        checkRefuseReason: this.returnForm.checkRefuseReason
      })
        .then((res) => {
          this.getList()
          this.closeReturn()
        })
        .catch(() => { })
    },
    // 扣除押金
    deductDeposit(id) {
      this.selectedId = id
      this.$refs.deductDialog.dialogVisible = true
    },
    // 取消代扣
    // cancelWithholding(id) {
    //   console.log('取消代扣')
    // },
    // 签署担保合同
    createCreditCompany(id) {
      this.$confirm('订单上征信后无法取消，确定要上征信吗？', '确认上征信', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          createCreditCompany(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 确认归还
    confirmReturn(id) {
      this.$confirm('确定要归还吗？', '确认归还', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderComfirmReturn(id).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 归还完成
    // finishReturn(id) {
    //   orderReturnFinish(id).then((res) => {
    //     this.getList()
    //   })
    // }
    // 查看物流
    checkLogistics(item) {
      this.editItem = item
      // this.selectedId = id
      this.$refs.checkLogistics.dialogVisible = true
    },
    // 查看已付账单详情
    checkPaidBill(id, paid_rent) {
      if (this.$hasMethod('#checkBill') && paid_rent > 0) {
        this.selectedId = id
        this.$refs.checkBill.dialogVisible = true
      }
    },
    // 查看认证资料
    checkAuthInfo(item) {
      console.log(item);
      this.editItem = {
        face_photo: item.face_photo,
        idcard_back: item.authentic.idcard_back,
        idcard_front: item.authentic.idcard_front,
        orderId: item.id
      }
      this.$refs.authInfo.dialogVisible = true
    },
    // 确认收货
    confirmReceipt(id) {
      this.selectedId = id
      this.$refs.receipt.dialogVisible = true
    },
    // 订单发货
    openDelivery(id) {
      this.selectedId = id
      this.$refs.delivery.dialogVisible = true
    },
    // 拒绝订单
    refuseorder(id) {
      this.$confirm('请确认是否拒绝该订单?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          rejectRefund({
            order_id: id
          })
            .then((res) => {
              // console.log(res);
              this.getList()
            })
            .catch(() => { })
        })
        .catch(() => { })
    },
    // 审核通过
    checkPass(id) {
      this.$confirm('需要上征信的订单必须要在审核通过前执行上征信操作完成，请确认是否审核通过该订单?', {
        confirmButtonText: '确定通过',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderCheckPass({
            orderId: id
          })
            .then((res) => {
              // console.log(res)
              this.getList()
            })
            .catch(() => { })
        })
        .catch(() => { })
    },
    // 查看流水记录
    viewFlow(trade_no) {
      this.selectedId = trade_no
      this.$refs.checkFlow.dialogVisible = true
    },
    // 查看客服备注
    viewRemark(id, type) {
      this.remarkType = type
      this.selectedId = id
      this.$refs.checkRemark.dialogVisible = true
    },
    // 添加客服备注
    addRemark(id, type) {
      if (type == 1) {
        this.titleDialog = "风控建议"
      } else {
        this.titleDialog = "客服备注"
      }
      this.selectedId = id
      this.$refs.setRemark.dialogVisible = true
    },
    // 设置充值押金
    setMoney(id) {
      this.selectedId = id
      this.$refs.setMoney.dialogVisible = true
    },
    // 退充值押金
    quitMoney(id) {
      this.$confirm('确定要退充值押金吗？', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          orderRechargeRefund({ orderId: id }).then((res) => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    // 更改设备编号
    editDevice(item) {
      this.editItem = {
        orderId: item.id,
        deviceNumber: item.device_number ? item.device_number.split(',') : [],
        amount: item.amount
      }
      this.$refs.setDevice.dialogVisible = true
    },
    // 修改地址
    editAddress(item) {
      this.editItem = {
        orderId: item.id,
        realname: item.realname,
        mobile: item.address_mobile,
        address: item.address,
        prov: item.prov,
        city: item.city,
        area: item.area,
        province: [item.prov, item.city, item.area]
      }
      this.$refs.setAddress.dialogVisible = true
    },
    // 查看租期
    viewLease(item) {
      this.selectedId = item.id
      let splitObj = {
        member_id: item.member_id,
        cert_name: item.authentic.cert_name
      }
      this.$refs.checkLease.setSplitPramas(splitObj)
      this.$refs.checkLease.dialogVisible = true
    },
    // 编辑订单
    editorder(item, num) {
      // 1分配订单到供应商   2 每期租金/租赁方式 3 买断金 4 供应商 5 更改押金
      this.editItem = {
        orderId: item.id,
        pact_type: item.pact_type_number,
        month_total: item.month_total,
        setmeal_price: item.setmeal_price,
        shopname: item.shopname,
        seller_id: item.seller_id,
        member_id: [],
        rent: item.lease.rent,
        activity_id: item.activity_id,
        setmeal_foregift_apply: item.setmeal_foregift_apply ? item.setmeal_foregift_apply : 0,
        setmeal_foregift: item.setmeal_foregift,
        num: num
      }
      this.$refs.editOrder.dialogVisible = true
    },
    handleOrderData(item) {
      this.dataItem = item
      this.orderDialogVisible = true
    },
    handleSubmit() {
      this.$refs['ruleFormOrder'].validate((valid) => {
        if (valid) {
          this.editItem = {
            orderId: this.dataItem.id,
            cert_name: this.dataItem.authentic.cert_name,
            cert_no: this.dataItem.authentic.cert_no,
            mobile: this.dataItem.mobile,
            rent_total: this.dataItem.rent_total,
            month_total: this.dataItem.month_total,
            website_price: this.dataItem.website_price,
            new_grade: this.dataItem.new_grade,
            goods_type: this.typeId
          }
          this.orderDialogVisible = false
          this.$refs.selectRisk.dialogVisible = true
        } else {
          this.$message({
            message: '请选择类型',
            type: 'error'
          })
          return false
        }
      })
    },
    handleChange(value) {
      this.typeId = value
    },
    // 三种要素查询&运营商基础信息
    handleThree(item, type) {
      this.threeType = type
      this.editItem = item
      this.$refs.threeDialog.dialogVisible = true
    },
    // 风险筛前
    handleRisk(item) {
      this.editItem = item
      this.$refs.antRiskDialog.dialogVisible = true
    },
    // 信贷洞察  
    handleAntCredit(item) {
      this.editItem = item
      this.$refs.antCreditDialog.dialogVisible = true
    },
    // 查询反欺诈
    handleAntFraud(item) {
      this.editItem = item
      this.$refs.antFraudDialog.dialogVisible = true
    },
    // 查询额度评级
    handleLimit(item) {
      this.editItem = item
      this.$refs.antLimitDialog.dialogVisible = true
    },
    // 查询经济能力
    handleEconomy(item) {
      this.editItem = item
      this.$refs.antEconomyDialog.dialogVisible = true
    },
    // 查看探针
    handleProbe(item) {
      this.editItem = item
      this.$refs.probeDialog.dialogVisible = true
    },
    // 查看学历
    handleEdu(item) {
      this.editItem = item
      this.$refs.eduDialog.dialogVisible = true
    },
    // 查看芝麻风控信息
    handleSesame(item) {
      console.log('aaaa--', item);
      if (item.credit_risk_info == null) {
        this.$message({
          message: '该用户暂无芝麻风控',
          type: 'error'
        })
      } else if (item.credit_risk_info.code && item.credit_risk_info.code === 'QUERY_REFUSED_FOR_NOT_CREDIT_AUTH') {
        this.$alert('非信用订单，只有信用预授权单才允许查询异步风控数据', '芝麻风控', {
          confirmButtonText: '确定',
          callback: action => { }
        })
      } else {
        this.editItem = item.credit_risk_info.data
        this.$refs.sesameDialog.dialogVisible = true
      }
    },
    // 查看征信
    selectCredit(item) {
      if (item.authentic.idcard_back == '暂无' || item.authentic.idcard_front == '暂无') {
        this.$message({
          message: '请先上传身份证照片',
          type: 'error'
        })
      } else {
        let that = this
        this.fullscreenLoading = true
        getFirstCreditNewData({ orderId: item.id }).then(async (res) => {
          this.fullscreenLoading = false
          let isConfirm = await that.$confirm('是否确认查看征信?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消'
          }).catch(() => { })
          if (isConfirm === "confirm") {
            that.newOrderId = item.id
            that.$refs.newSelectRisk.dialogVisible = true
          }
        }).finally(() => {
          this.fullscreenLoading = false
        })
      }
    },
    // 测试页面  全景雷达以及探针
    publicDialog(item) {
      this.$confirm('是否确认查看全景雷达以及探针?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(async () => {
        let params = {
          orderId: item.id,
          cert_name: item.authentic.cert_name,
          cert_no: item.authentic.cert_no,
          mobile: item.mobile
        }
        let obj = {}
        console.log(111);
        this.fullscreenLoading = true
        let res = await getBehaviorData(params).catch(e => {
          this.fullscreenLoading = false
          this.respCode()
        })
        obj.radarName = res.cert_name
        obj.radarOrderId = res.order_id
        obj.radarStart = res.start_at
        obj.radarEnd = res.end_at
        obj.radarData = res?.result2?.data || {}
        obj.probeData = res.data || {}
        this.editItem = obj
        this.respCode(obj.radarData, obj.probeData, "publicDialog")
        // this.getList()
      }).catch(() => { })
    },
    respCode(item, item1, code) {
      this.fullscreenLoading = false
      if (Object.values(item).length == 0 && Object.values(item1).length == 0) {
        this.$refs.publicDialog.dialogVisible = false
        this.$message({
          message: "该用户没有雷达风控数据风险",
          type: "error"
        })
      } else {
        if (code === "publicDialog") this.$refs.publicDialog.dialogVisible = true
      }
    },
    // 上征信
    setCreditData(orderId) {
      this.$confirm('该订单上征信之前必须先查看征信报告，是否确认上征信?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(() => {
          setCreditData({ orderId: orderId }).then(res => {
            this.getList()
          })
        })
        .catch(() => { })
    },
    getOrderStatusType(status) {
      const obj = this.statusList.find((item) => item.id === status)
      return obj ? obj.type : 'warning'
    },
    getOrderStatusName(status) {
      const obj = this.statusList.find((item) => item.id === status)
      return obj ? obj.name : ''
    },
    // 获取数据
    getList(flag) {
      // flag为true, 则不刷新表格
      const { page, pageSize } = this.$refs.customPage
      if (!flag) {
        this.tableData = []
      }
      this.listLoading = true
      orderList2({
        page,
        pageSize,
        ...this.searchForm,
        orderStatusGroup: this.activeName
      }).then((res) => {
        const { list, count } = res
        this.tableData = list.data || []
        this.total = list.total || 0
        for (const item of this.tabList) {
          item.count = count[item.id]
        }
        this.listLoading = false
      }).catch(e => {
        this.listLoading = false
        this.$message.error('加载失败')
      })
    },
    // 查询
    search() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.orderCreateTime = pickerVal
        this.$refs.customPage.page = 1
        this.getList()
      }
    },
    // 重置
    reset() {
      if (this.$refs.myDatePicker) {
        this.$refs.myDatePicker.reset()
      }
      this.searchForm = {
        orderID: '',
        orderNo: '',
        goodsName: '',
        receivingName: '',
        receivingMobile: '',
        orderStatus: '',
        orderCreateTime: '',
        shopName: '',
        address: ''
      }
      this.getList()
    },
    // 导出
    exportFile() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.orderCreateTime = pickerVal
        orderListExport({
          ...this.searchForm,
          orderStatusGroup: this.activeName
        })
      }
    },
    exportFile2() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.orderCreateTime = pickerVal
        OrderDetailExport({

        })
      }
    },
    handleClick(tab) {
      this.activeName = tab.name
      this.$refs.customPage.page = 1
      this.getList()
    },
    getSelect() {
      getOrderStatus().then((res) => {
        const list = []
        for (const key in res) {
          list.push({
            id: key,
            name: res[key]
          })
        }
        this.selectList = list || []
      })
    },
    getRemark() {
      isOrderRemark().then((res) => {
        const remark_list = []
        for (const key in res) {
          remark_list.push({
            id: key,
            name: res[key]
          })
        }
        this.remarkList = remark_list || []
      })
    },
    tempClick(id) {
      console.log(id);
      this.selectedId = id
      this.$refs.tempDialog.dialogVisible = true
    },
    // 查看大数据
    getBigData(item) {
      let address = item.prov + item.city + item.area + item.address
      this.editItem = {
        order_id: item.id,
        cert_name: item.authentic.cert_name,
        cert_no: item.authentic.cert_no,
        mobile: item.address_mobile,
        address
      }
      this.$refs.bigData.dialogVisible = true
    }
  }
}
</script>
<style lang="scss" scoped>
.common_form_search {
  padding: 15px 30px 0;
}

.child_page {
  padding-bottom: 15px;
  padding-left: 30px;
  padding-right: 30px;

  p,
  div {
    box-sizing: border-box;
  }
}

.list_wrap {
  position: relative;
}

.list_header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  min-height: 50px;
  z-index: 2;
  background: #f5f5f5;
  border: 1px solid #e6e6e6;

  p {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }

  p:not(:first-child) {
    border-left: 1px solid #e6e6e6;
  }
}

.list_item {
  border: 1px solid #e6e6e6;
  margin-top: 10px;
}

.item_row {
  border-top: 1px solid #e6e6e6;

  &>div {
    padding: 10px;
    color: #666666;

    &:not(:first-child) {
      border-left: 1px solid #e6e6e6;
    }
  }
}

.detail,
.btns {
  padding: 10px;
}

.btns {

  // border-left: 1px solid #e6e6e6;
  .el-button+.el-button {
    margin-left: 10px;
  }
}

.border-btn {
  height: 25px;
  padding-top: 0;
  padding-bottom: 0;
  background: #ffffff;
  border: 1px solid $mainBlue;
  border-radius: 3px;
  color: $mainBlue;
  font-size: 12px;
}

.sign_icons img {
  width: 21px;
  height: 23px;
  margin-right: 2px;
}

.item_header {
  padding: 5px 10px;
  background-color: #f5f5f5;

  &>div p {
    color: #666666;
    font-size: 12px;
    padding-left: 20px;
  }
}

.title {
  font-size: 16px;
  line-height: 23px;
  padding-bottom: 15px;
}

.meal,
.device {
  font-size: 12px;
  color: #999999;
  line-height: 23px;
}

.item_row p {
  line-height: 23px;
}

.item_row div {
  line-height: 20px;
}

.every {
  border-bottom: 1px solid #f5f5f5;
  margin-top: -60px;
  padding-bottom: 0;
}

.every .el-tag {
  width: 74px;
  text-align: center;
  font-size: 14px;
}

.btns {
  padding-left: 0;
}

.btns .el-button {
  margin-left: 10px;
  margin-bottom: 10px;
}

.tip_img {
  margin-top: -100px;
  padding-bottom: 5px;
}

.tip_img img {
  margin-right: 5px;
  height: 20px;
}

.tip_img .zheng {
  height: 24px;
}

.text-ellipsis span {
  color: purple;
}
</style>
